set(appName "fem1d")

file(GLOB appSourceFile "*.cpp")
file(GLOB appSourceFileList ${appSourceFile} ${sourceFileList})


add_executable(${appName} ${appSourceFileList})

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
    #dynamic link
    #target_link_libraries(${appName} -lcgns -lgomp -lmpich -lhdf5 -lmfem -lHYPRE -lmetis)
    
    #static link
    target_link_libraries(${appName} -ldl ${thirdPartyLibDir}/cgns/lib/libcgns.a ${thirdPartyLibDir}/hdf5/lib/libhdf5.a -lgomp -lmpich -lmfem -lHYPRE -lmetis -lz -lpthread -l0000386E_00000164_x64)
    
    if(enable_superlu)
        target_link_libraries(${appName} -lsuperlu -lblas)
    endif()

    #petsc
    if(enable_petsc)
        target_link_libraries(${appName} -lpetsc)
    endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
    target_link_libraries(${appName} ${libraryDir})
endif()





#set_target_properties(${appName} PROPERTIES INSTALL_RPATH "$ORIGIN/../lib")

install(
    TARGETS ${appName} 
    EXPORT ${appName}Targets
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib
    RUNTIME DESTINATION bin
    PUBLIC_HEADER DESTINATION include
)
